package com.xueyu.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xueyu.dao.SysuserDao;
import com.xueyu.domain.sys.Sysuser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("open-Communicate")
public class CommunicateController {

    @Autowired
    SysuserDao sysuserDao;
    @RequestMapping(value = "selectUser")
    @ResponseBody
    public Map selectUser(String like){
        Map map = new HashMap();
        QueryWrapper<Sysuser> queryWrapper = new QueryWrapper<Sysuser>();
        queryWrapper.eq("username",like);
        List<Sysuser> sysuserList = sysuserDao.selectList(queryWrapper);
        map.put("user",sysuserList.get(0).getUsername());
        return map;
    }

}
